package com.js.study.datastructs.tree;

/**
 * @Author JiangSen
 * @DATE 2023/12/27 13:57
 */
public class ComparableDemo {
    public static void main(String[] args) {
        Node n1 = new Node(11);
        Node n2 = new Node(11);
        int resutl = n1.compareTo(n2);
        System.out.println("result=" + resutl);
    }
}
    class Node implements Comparable<Node>{
        int number;

        public Node(int number){
            this.number = number;
        }

        @Override
        public int compareTo(Node o) {
            if(this.number > o.number){
                return 1;
            }else if(this.number < o.number){
                return -1;
            }else{
                return 0;
            }
        }
    }


